﻿using System;
using System.Collections.Generic;


namespace GrandwayLib.Meters.Interfaces
{
    /// <summary>
    /// 光开关类
    /// </summary>
    public interface IOpticalSwitch
    {
        /// <summary>
        /// 光开关名字
        /// </summary>
        string Name { get; }

        /// <summary>
        /// 通道数量
        /// </summary>
        int ChannelCount { get; }

        /// <summary>
        /// 连接的参数类型
        /// </summary>
        Type ParamType { get; }

        /// <summary>
        /// 连接参数
        /// </summary>
        object ConnectParam { set; get; }

        /// <summary>
        /// 是否已连接
        /// </summary>
        bool IsConnected { get; }

        /// <summary>
        /// 通道对应的波长 key - 通道号、value - 波长
        /// </summary>
        Dictionary<int,int> ChannelWavelength { set; get; }


        /// <summary>
        /// 连接光开关
        /// </summary>
        /// <returns>是否连接成功</returns>
        bool Connect();

        /// <summary>
        /// 断开光开关
        /// </summary>
        void DisConnect();

        /// <summary>
        /// 切换到指定波长
        /// </summary>
        /// <param name="wavelength">波长</param>
        /// <returns>是否切换成功</returns>
        bool SwitchChannel(int wavelength);

        /// <summary>
        /// 连接后异常断开产生事件
        /// </summary>
        event EventHandler BreakConnect;
    }
}
